package ai.evadeControllers;

import com.jme.math.Vector3f;

import logic.common.player.Player;
import logic.ships.hunter.Hunter;

public class HardEvadeController extends MediumEvadeController {
	
	private static final long serialVersionUID = 1L;
	
	protected Vector3f currentEvadeLoc;
	
	public HardEvadeController(Player bot) {
		super(bot);
	}
	
	@Override
	protected void evade(float time) {
		Hunter hunter = bot.getHunter();
		if(hunter.hasAttackingHeatSeeker()) {
			if(currentEvadeLoc == null || currentEvadeLoc.distance(hunter.getLocalTranslation()) <= 10f) {
				Vector3f evadeDir = getRandomVector(70, 100);
				currentEvadeLoc = hunter.getLocalTranslation().add(evadeDir);
			}
			rotateTo(currentEvadeLoc, time * agility, false);
		} else super.evade(time);
	}
}